package com.bjsxt.list;

import java.util.LinkedList;
import java.util.List;

public class TestLinkedList {
    public static void main(String[] args) {

        //LinkedList底层是一个双向链表
        LinkedList<String> list = new LinkedList<String>();

        list.add("hello");
        list.add("world");
        list.add("java");
        System.out.println(list);

        System.out.println("==============");

        //特有的方法
        list.addFirst("java1");
        list.addLast("java2");
        System.out.println(list);

        System.out.println("==============");

        System.out.println(list.getFirst());
        System.out.println(list.getLast());

        System.out.println("==============");

        System.out.println(list.removeFirst());
        System.out.println(list.removeLast());

        System.out.println("==============");

        System.out.println(list);




    }
}
